﻿<%--
 *  File:    BunchnoFileManage.jsp
 *  @Author: JackWang
 *  Date:    2012.6.4

 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
<%@ page import="java.text.*"%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%
Category cat = Category.getInstance("jsp.BunchnoFileManage");
String strModuleName = "TDR";
String privilegeCode = "A0901";
String strTableName = "v_zyluploadfile";
String contextPath = request.getContextPath();
%>
<%@ include file="/inc/CommonHeader.inc"%>
<%@ include file="/inc/OvalLocationDefault.inc"%>
<%@ include file="/rpt/ReportURL.inc"%>
<html>
<head>
<title>MonthSalesDataSummary</title>
<PageFlow:CheckPageFlow pageName="p_uploadfilelog" />

<%@ include file="/inc/CatchError.inc"%>
<%@ include file="/inc/SumDiv.inc"%>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet"
	href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css"
	type="text/css">
<script language="JavaScript" src="<%=contextPath%>/js/FuncLib.js"></script>
<script language="JavaScript"
	src="<%=contextPath%>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript"
	src="<%=contextPath%>/js/SummaryDivision.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/Calendar.js"></script>

<%@ include file="/inc/NewCalendar.inc"%>
<%

Vector totalsummary = (Vector)pageContext.getAttribute("totalsummary");
if(totalsummary == null) totalsummary = new Vector();

HashMap Errorinformation = (HashMap)session.getAttribute("errorinformation");
if(Errorinformation == null) Errorinformation = new HashMap();

HashMap UserInfo = (HashMap)session.getAttribute("userinfo");
if(UserInfo == null) UserInfo = new HashMap();
String dateFormat = (String)session.getAttribute("dateformat");
if(dateFormat==null)dateFormat = "yyyy-MM-dd"; %>
<script language="JavaScript"><!-- 
function page_summary(actionvalue,orderbyname)
{
 //alert(eval('cform.vstatus').value);
 if(!checkDate()) return;
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  if(!editform) return;
  editform.action = "BunchnoFileManage.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}

function page_allcheckselect(){
	var allcheck = cform.checkall.checked;
	var alldatafile = document.getElementsByName('fileids');
	var length = alldatafile.length;
	//alert(alldatafile[0].value);
	if(allcheck){
		for(var i = 0 ; i < length;i++){
			if(!alldatafile[i].disabled)
			alldatafile[i].checked = true;
		}
	}else{
		for(var i = 0 ; i <= length;i++){
			alldatafile[i].checked = false;
		}	
	}
}



function checkDate()
{
	var startdate =document.cform.startdate.value;
	var enddate =document.cform.enddate.value;
	
if (!isEmpty(enddate))
{
  if (toDate(startdate, '<%=JspHelper.filterNull( session.getAttribute("dateformat") )%>') > toDate(enddate, '<%=JspHelper.filterNull( session.getAttribute("dateformat") )%>'))
  {
    alert('<%= message.getMessageDesc("DATE1_SHOULD_NOTLATE_THAN_DATE2") %>');
    return false;
  }
  return true;
}
return true;  
}

function page_unload()
{ 
     //alert(cform.startdate.value+" "+cform.enddate.value);
    //var alldatafile = document.getElementsByName('fileids');
    //alert(document.cform.fileids[0].value+" " + document.cform.numrows.value);
    //alert('序号'+cform.fileids[1].value+'状态为关闭才可删除,请重新选择！');
   for(var i=0;i<cform.fileids.length;i++){
		var n = i;
		if(cform.fileids[i].checked){
			if(eval('cform.status'+n).value != 99)
				{
				alert('状态为关闭才可删除,请重新选择！');
				return;
		 }
		}
   }
    if(nullChecked(document.cform.fileids,document.cform.numrows.value)){
		alert("<%= message.getMessageDesc("MUST_SELECT_ONE_RECORD") %>");
		return;
	}

	if(!confirm("<%= message.getMessageDesc("ARE_YOU_SURE_UNINSTALL") %>"))
		return;	

    cform.actionname.value = "unload";
    cform.target = "_self";
    isRunning = true;
    cform.submit();


}
--></script>
</head>
<body>
<iframe id="reloadHandler" name="reloadHandler" style="display:none"></iframe>
<% //--------------------------------------  page location --%>
<%@ include file="/inc/PageLocation.inc"%>
<table width="100%" cellspacing="0" border="0" cellpadding="0">
	<form name="cform" method="post" action="<%=contextPath %>/Dispatcher"
		target="_self"><input type="hidden" name="pagename"
		value="p_uploadfilelog"> <input type="hidden" name="actionname"> <custom:hidden
		property="tempstatus"></custom:hidden>
	<table width="100%" cellspacing="0" border="0" cellpadding="0">
		<tr>
			<td>
			<table width="900" border="0" cellspacing="0"
				onkeydown="if(event.keyCode==13) page_summary('search');">
				<tr>
					<td><%= label.getLabelName("L_FileName") + label.getLabelName("L_Colon") %></td>
					<td><custom:text property="filename" size="20" /></td>
					<td><%= label.getLabelName("L_UploadMan")%><custom:text
						property="username" size="20" /></td>
					<td><%= label.getLabelName("L_Status") + label.getLabelName("L_Colon") %></td>
					<td><custom:selectdic property="vstatus" dictType="Status"
						defaultValue="-----" valueCriteria="0,99" /> <custom:hidden
						property="vstatus"></custom:hidden></td>

					<%
                SimpleDateFormat formatter1 = new SimpleDateFormat ("yyyy-MM-dd");
                String str_date_end=formatter1.format(new Date());
                
              %>

					<td><%= label.getLabelName("L_UploadTime") + label.getLabelName("L_Colon") %></td>
					<td><custom:text property="startdate" dataType="date" module="IMG"
						size="15" /> <a
						onclick="javascript:c.show(this,'cform.startdate','yyyy-MM-dd');"><custom:button
						type="3" label="L_Asterisk" imgsrc="Time.gif" border="0" /></a>
					-- <%if(pageContext.getAttribute("enddate")==null){%> <custom:text
						property="enddate" dataType="date" dataFormatName="dateformat"
						module="IMG" size="15" value="" /> <%}else{%> <custom:text
						property="enddate" dataType="date" dataFormatName="dateformat"
						module="IMG" size="15" /> <%}%> <a
						onclick="javascript:c.show(this,'cform.enddate','yyyy-MM-dd');"><custom:button
						type="3" label="L_Asterisk" imgsrc="Time.gif" border="0" /></a>
					&nbsp;&nbsp;&nbsp;<a href="javascript:page_summary('search')"><img
						src="<%= contextPath %>/images/<%= strLanguageCode %>/go_fy.gif"
						border="0" style="border: 1 solid #000000"></a></td>

				</tr>
			</table>
			</td>
		</tr>
		<tr>
			<td><br>
			<div class="title-big-b-center"><%= label.getLabelName("L_BunchnoLog") %></div>
			<table width="1000" border="0" cellspacing="0">

				<tr>
					<td style="width:40px;">&nbsp;</td>
					<td style="width:150px;">&nbsp;</td>
					<td style="width:40px;">&nbsp;</td>
					<td style="width:150px;">&nbsp;</td>
					<td style="width:40px;">&nbsp;</td>
					<td style="width:150px;">&nbsp;</td>
					<td style="width:60px;">&nbsp;</td>
					<td style="width:150px;">&nbsp;</td>
					<td style="width:60px;">&nbsp;</td>
					<td style="width:150px;">&nbsp;</td>
				</tr>
			</table>
			<table width="100%" border="1" cellpadding="0"
				bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0"
				align="center">
				<tr class="deepblue-left">
					<td width="3%" class="title_center"><custom:checkbox
						property="checkall" styleClass="checkbox"
						onclick="page_allcheckselect()" /></td>

					<td width="5%" class="title_center"><%= label.getLabelName("L_Sequence") %></td>
					<td width="27%" class="title_center"><a
						href="javascript:page_summary('orderby','filename')"><%= label.getLabelName("L_FileName")%></a></td>
					<td width="10%" class="title_center"><a
						href="javascript:page_summary('orderby','datadate')"><%= label.getLabelName("L_CreateDate") %></a></td>
					<td width="10%" class="title_center"><a
						href="javascript:page_summary('orderby','username')"><%= label.getLabelName("L_UploadMan") %></a></td>
					<td width="10%" class="title_center"><a
						href="javascript:page_summary('orderby','valuename')"><%= "文件"+label.getLabelName("L_Status") %></a></td>
				</tr>
				<%
				int i=0;
				
				%>
				<logic:iterate id="onerow" collection="<%= totalsummary %>"
					indexId="idx" scope="page">
					<% 
	  HashMap row = (HashMap)pageContext.getAttribute("onerow");
					i++;

%>
					<tr onMouseOver="this.className='tr-over'"
						onMouseOut="this.className=''" class="">
						<td class="title_center"><input
							id="fileids<%=JspHelper.filterNull(i-1)%>" name="fileids"
							type="checkbox"
							value="<custom:write name="onerow" property="uploadfileid"/>"
							class="normalradio"></td>
						<td class="title_center"><%=i%></td>
						<td class="title_center"><custom:write property="filename"
							name="onerow" nbsp="true" /></td>
						<td class="title_center"><custom:write property="datadate"
							name="onerow" nbsp="true" /></td>
						<td class="title_center"><custom:write property="username"
							name="onerow" nbsp="true" /></td>
						<td class="title_center"><custom:write property="valuename"
							name="onerow" nbsp="true" /></td>

						<%
							String str1 = "status"+JspHelper.filterNull(i);
						    //String str2 = "userid"+JspHelper.filterNull(i);
						 %>
						<custom:hidden name="onerow" property="status"
							colIndex="<%=new Integer(i-1)%>" />
					</tr>

				</logic:iterate>
				<input type="hidden" name="numrows" value="<%=totalsummary.size()%>" />
				<%@ include file="/inc/SummaryAction.inc"%>
			</table>
			<table width="100%" cellspacing="0" cellpadding="0">
				<tr>
					<td class="summary_top"></td>
				</tr>
				<tr>
					<td class="td_center"><a onClick="page_unload();"><custom:button
						type="1" label="L_UninstallSelectedItems" imgsrc="new.gif"
						border="0" style="width:80" privilegeCode="B0004" /><a></td>
				</tr>
			</table>
			</td>
		</tr>
		</form>
	</table>
</body>
<script type="text/javascript">
//alert(<%=totalsummary.size()%>);
//var lenth=cform.fileids.length;
//alert(lenth);
 if (typeof(cform.fileids.length)=="undefined"){
     //alert("123");
     if(eval('cform.status0').value == 0){
    	 cform.fileids.disabled=true;
     }
  }
 else{
  for(var i=0;i<cform.fileids.length;i++){
     if(eval('cform.status'+i).value == 0){
    	 cform.fileids[i].disabled=true;
     }
   }
}
</script>
</html>
